#include <REGX52.H>
#include "timer.h"
#include "DELAY.h"
#include <INTRINS.H>

int cir=0;

int main()
{
	Timer0_Init();
	P2=0xfe;
	while(1)
	{
		int numret= Key_Number();
		if(numret==1)
		{
			cir=0;//向左循环
		}
		else if(numret==2)
		{
			cir=1;//向右循环
		}
	}
	return 0;
}


void Timer0_interrupt() interrupt 1
{
	static unsigned int num=0;
	TH0=0xfc;//1111 1100
	TL0=0x18;//0001 1000
	num++;
	if(num==1000)
	{
		if(cir==0)
		{
			P2=_crol_(P2,1);
		}
		else if(cir==1)
		{
			P2=_cror_(P2,1);
		}
		num=0;
	}
}